import { getMenuApi } from "@/api/menu/menu"
import { StatusCode } from "@/http/request"
import { onMounted, reactive } from "vue"

export default function tableList() {
    // 定义表格数据
    const tableData = reactive({
        list: []
    })
    // 获取表格数据
    const getList = async () => {
        let res = await getMenuApi()
        // console.log(res)
        if(res && res.code === StatusCode.Success) {
            tableData.list = res.data
        }
    }
    // 定义列表查询的参数
    const listQuery = reactive({
        currentPage: 1,
        pageSize: 10,
        name: ''
    })
    onMounted(() => {
        getList()
    })
    return {
        tableData,
        listQuery,
        getList
    }
}